package com.example.yuejian21.nongfusanquan.yuejian21.model;

import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Clubcoursebean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Collectcoursebean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Coursebean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.IsCollectcoursebean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Orderbean;
import com.example.yuejian21.nongfusanquan.yuejian21.service.CourseService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Nongfusanquan on 2017-10-12.
 */

public class Coursemodel {
    private Retrofit retrofit;
    public Coursemodel(){
        //创建实例
        retrofit =new Retrofit.Builder()
                .baseUrl("http://10.0.2.2/yuejian14/index.php/API/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public Call<List<Coursebean>> getTrainlist(){
        CourseService trainService = retrofit.create(CourseService.class);
        return trainService.getTrainlist();
    }
    public Call<List<Clubcoursebean>> getclubcourse(){
        CourseService trainService = retrofit.create(CourseService.class);
        return trainService.getclubcourse();
    }


    public Call<Orderbean> addtrainn(int u_id, int t_id){
        CourseService trainService = retrofit.create(CourseService.class);
        return trainService.addtrainn(u_id,t_id);
    }
    public Call<Coursebean> getDetail(int t_id){
        CourseService trainService = retrofit.create(CourseService.class);
        return trainService.getDetail(t_id);
    }
}
